package com.cdd.common.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

/**
 * 聊天收费设置
 */
@TableName("app_price_set")
public class AppPriceSet implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;
    private String price;//价格
    private Integer charmLevel;//是否有魅力值限制
    private Integer charmLevelCondition;//魅力值等级条件
    private Integer type;//1消息价格 2语音价格 3视频价格

    @TableField(exist = false)
    private String name;
    @TableField(exist = false)
    private String surfaceName;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public Integer getCharmLevel() {
        return charmLevel;
    }

    public void setCharmLevel(Integer charmLevel) {
        this.charmLevel = charmLevel;
    }

    public Integer getCharmLevelCondition() {
        return charmLevelCondition;
    }

    public void setCharmLevelCondition(Integer charmLevelCondition) {
        this.charmLevelCondition = charmLevelCondition;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName() {
        String name = null;
        String surfaceName = null;
        String suffix = "";

        if (this.price.equals("0")) {
            name = "免费";
            surfaceName = "免费";
        } else {
            if (this.type == 1 && !this.price.equals("0")) {
                suffix = "/条";
            } else if ((this.type == 2 || this.type == 3) && !this.price.equals("0")) {
                suffix = "/分钟";
            }

            name = this.price + "钻石";
            surfaceName = name + suffix;
            if (this.charmLevel == 1) {
                surfaceName = surfaceName + "（魅力值达到" + this.charmLevelCondition + "可选）";
            }
        }

        this.name = name;
        this.surfaceName = surfaceName;
    }

    public String getSurfaceName() {
        return surfaceName;
    }

    public void setSurfaceName(String surfaceName) {
        this.surfaceName = surfaceName;
    }
}
